package leetcodecompetition.S105;

import java.util.*;

/**
 * @Author: Siantar
 * @Date: 2023-05-27-22:58
 * @Description: 1.0
 */
public class T6393 {
    public long maxStrength(int[] nums) {
        if (nums.length == 1 && nums[0] < 0) return nums[0];
        long res = Arrays.stream(nums).mapToLong(a -> Long.parseLong(a + "")).reduce((a, b) -> {
            if (a == 0) return b;
            if (b == 0) return a;
            return a * b;
        }).getAsLong();
        int c = Arrays.stream(nums).reduce((a, b) -> {
            if (a * b > 0) return Math.max(a, b);
            else if (a * b < 0) return Math.min(a, b);
            else return a == 0 ? b : a;
        }).getAsInt();
        boolean b = Arrays.stream(nums).anyMatch(a -> a == 1);
        System.out.println(res);
        System.out.println(c);
        return res > 0 ? res : res == c ? b ? 1 : 0 : res / c;
    }
}
